var Draw	= {
	ctx		: null,
	
	start		: function(){
		this.ctx	= canvas.getContext('2d');
	},
	
	gradient	: function(coords, w, h, dirA, dirB, colorA, colorB){
		var grd = this.ctx.createLinearGradient(dirA.x, dirA.y, dirB.x, dirB.y);
		grd.addColorStop(0, colorA);
		grd.addColorStop(1, colorB);
		this.ctx.fillStyle = grd;
		this.ctx.fillRect(coords.x, coords.y, w, h);
	},
	
	line		: function(a, b, color){
		this.ctx.beginPath();
		this.ctx.strokeStyle	= color;
		this.ctx.moveTo(a.x, a.y);
		this.ctx.lineTo(b.x, b.y);
		this.ctx.stroke();
		this.ctx.closePath();
	},

	rect		: function(coords, w, h, color, border) {
		this.ctx.beginPath();
		this.ctx.fillStyle = color;
		this.ctx.rect(coords.x, coords.y, w, h);
		this.ctx.fill();
		if(border != ""){
			this.ctx.strokeStyle	= border;
			this.ctx.stroke();
		}
	},
	
	circle		: function(coords, r, color, border) {
		this.ctx.beginPath();
		this.ctx.fillStyle	= color;
		this.ctx.arc(coords.x, coords.y, r, 0, Math.PI*2, true);
		this.ctx.fill();
		if(border != ""){
			this.ctx.strokeStyle	= border;
			this.ctx.stroke();
		}
		this.ctx.closePath();
	},

	text		: function(coords, text) {
		this.ctx.font		= "bold 14px sans-serif";
		this.ctx.fillStyle	= this.rgbColor(90, 90, 90);
		this.ctx.fillText(text, coords.x, coords.y);
	},

	rgbColor	: function(r, g, b){
		return this.rgbaColor(r, g, b, 1);
	},
	
	rgbaColor	: function(r, g, b, a){
		var R	= Math.round(255*(r/100));
		var G	= Math.round(255*(g/100));
		var B	= Math.round(255*(b/100));
		var A	= a;
		return "rgba("+R+", "+G+", "+B+", "+A+")";
	}
}
